package com.cin.cma.server.pos.controller;


import com.cin.cma.common.model.ApiResponse;
import com.cin.cma.common.model.finixx.base.BaseRequest;
import com.cin.cma.common.model.finixx.request.AllSystemSettingRequest;
import com.cin.cma.common.model.finixx.request.BKBookingOrderRequest;
import com.cin.cma.common.model.finixx.request.IncreaseBookingSettingRequest;
import com.cin.cma.common.model.finixx.response.*;
import com.cin.cma.server.pos.service.IBasicService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 基础能力
 *
 *
 * @Date：2024/7/19 16:40
 */
@RestController
@RequestMapping("basic")
public class BasicController {
    @Autowired
    private IBasicService basicService;

    /**
     * 获取接口令牌
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getPassNum")
    public ApiResponse<PassNumResponse> getPassNum(@RequestBody @Valid BaseRequest model) throws Exception {
        return ApiResponse.success(this.basicService.getPassNum(model));
    }

    /**
     * 获取本地影院信息
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getLocalCinema")
    public ApiResponse<LocalCinemaResponse> getLocalCinema(@RequestBody @Valid BaseRequest model) throws Exception {
        return ApiResponse.success(this.basicService.getLocalCinema(model));
    }

    /**
     * 获取系统时间
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("globalSystemTime")
    public ApiResponse<SystemTimeResponse> globalSystemTime(@RequestBody @Valid BaseRequest model) throws Exception {
        return ApiResponse.success(this.basicService.globalSystemTime(model));
    }

    /**
     * 获取渠道信息
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getIncreaseBookingSetting")
    public ApiResponse<IncreaseBookingSettingResponse> getIncreaseBookingSetting(@RequestBody @Valid IncreaseBookingSettingRequest model) throws Exception {
        return ApiResponse.success(this.basicService.getIncreaseBookingSetting(model));
    }

    /**
     * 获取系统基本信息
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("allSystemSetting")
    public ApiResponse<AllSystemSettingResponse> allSystemSetting(@RequestBody @Valid AllSystemSettingRequest model) throws Exception {
        return ApiResponse.success(this.basicService.allSystemSetting(model));
    }

    /**
     * 订单提交（支持混合订单混合支付及取票）
     *
     * @param model
     * @return
     * @throws Exception
     */
    @ResponseBody
    @PostMapping("bookingOrder")
    public ApiResponse<BookingOrderResponse> bookingOrder(@RequestBody @Valid BKBookingOrderRequest model) throws Exception {
        return ApiResponse.success(this.basicService.bookingOrder(model));
    }

}
